package org.geektimes.configuration.micro.config.source;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class JavaPropertyConfigSource extends MapBasedConfigSource {

    private Map<String, String> properties = new HashMap<>();

    public JavaPropertyConfigSource() {
        super("Java Property", 400);
    }

    @Override
    protected void prepareConfigData(Map<String, String> configData) throws Throwable {
        Properties properties = System.getProperties();
        for (String stringPropertyName : properties.stringPropertyNames()) {
            configData.put(stringPropertyName,properties.getProperty(stringPropertyName));
        }
    }
}
